package constant

import (
	"mall/pkg/ecode"
)

// SystemError
var (
	ErrSystemError = ecode.ErrSystemError
)

// InvalidArgument
var (
	ErrPermissionNotExist  = ecode.BadRequest("权限不存在")
	ErrObjectNotExist      = ecode.BadRequest("所选对象不可用, 请刷新列表重试")
	ErrExceedOrderLimit    = ecode.BadRequest("最多同时创建100个订单")
	ErrInvalidOrderKeyType = ecode.BadRequest("订单号生成失败")
)

// BizError
var (
	ErrPermissionError = ecode.BizError("PERMISSION_ERROR", "权限不足")
	ErrDuplicateInput  = ecode.BizError("DUPLICATE_INPUT", "同名数据已存在")
	ErrForbiddenAction = ecode.BizError("FORBIDDEN_ACTION", "操作禁止")
	ErrMaximumNumber   = ecode.BizError("MAXIMUM_NUMBER", "数值超过可存储最大范围")
	ErrMallNotOpen     = ecode.BizError("MALL_NOT_OPEN", "商城未开通")
	// 以下三个错误，由于仓库属性可能在下单前后改变，因此
	ErrNeedRefresh = ecode.BizError("NEED_REFRESH", "当前页面信息过旧，请刷新页面再试")
	// 下游服务调用失败
	ErrRemoteError      = ecode.BizError("REMOTE_ERROR", "下游服务调用失败")
	ErrDataBaseTimeout  = ecode.BizError("DATABASE_TIMEOUT", "数据库调用超时")
	ErrContextCancelled = ecode.BizError("CONTEXT_CANCELLED", "用户取消请求")
)

// Unauthenticated
var ErrUnauthenticated = ecode.Unauthenticated("登录已失效，请重新登录")
